
//热门试用
$(function () {
    $.ajax({
        url: "http://127.0.0.1:3000/useing/public",
        type: "get",
        success: function (res) {
            // console.log(res);
            for (var i = 0; i < res.length; i++) {
                $('.shiy_img ul').append(
                    `<li>
                    <img src="${res[i].img}" alt="">
                    <span>${res[i].text}</span><br>
                    <span>${res[i].totalnum}</span>
                    <span>${res[i].num}台</span><br>
                    <span>${res[i].apply}申请</span><br>
                    <span>剩余时间2天</span>
                </li>`
                )
            }
        }
    })
    var left = 0;
    $('.left').click(function () {
        left -= 352
        if (left < -3168) {
            left = 0
        }
        $(this).siblings('ul').css({ left: left })
    })
    $('.right').click(function () {
        left += 352
        if (left > 0) {
            left = -3168
        }
        $(this).siblings('ul').css({ left: left })
    })

    // 报告精选
    $.ajax({
        url: "http://127.0.0.1:3000/report/new",
        type: 'get',
        success: function (arr) {
            // console.log(arr);
            for (var i = 0; i < 8; i++) {
                $('.baog_bx ul').append(
                    `<li>
                    <img class="baog_img" src="${arr[i].img}" alt="">
                    <span>${arr[i].text}</span><br>
                    <span>● ${arr[i].uName}</span><span><img src="./img/zan.png" alt=""> 3 <img src="./img/reply.png" alt=""> 3 </span>
                </li>`
                )
            }
        }
    })

    //导购精选
    $.ajax({
        url: "http://127.0.0.1:3000/guid/new",
        type: 'get',
        success: function (res) {
            // console.log(res);
            for (var i = 0; i < 4; i++) {
                $('.daog_bx ul').append(
                    `<li>
                    <img class="daog_img" src="${res[i].img}" alt="">
                    <span>${res[i].text}</span><br>
                    <span><img src="./img/zan.png" alt=""> 3 <img src="./img/reply.png" alt=""> 3 </span>
                </li>`
                )
            }
        }
    })

    //发现酷玩
    $.ajax({
        url: "http://127.0.0.1:3000/report/hot",
        type: 'get',
        success: function (res) {
            console.log(res);
            for (var i = 0; i < 16; i++) {
                $('.kuw_bx ul').append(
                    `<li>
                    <img class="kuw_img" src="${res[i].img}" alt="">
                    <span>${res[i].text}</span><br>
                    <span><img src="./img/zan.png" alt=""> 3 <img src="./img/reply.png" alt=""> 3 </span>
                </li>`
                )
            }
        }
    })
})